#include "face.h"
#include "vector.h"
#include "particle.h"

Face::Face(){
    id = 0;
//    twin = NULL;
}

Face::Face(unsigned int _id) : id(_id){
//    twin = NULL;
}

Face::Face(unsigned int _id, std::vector<Particle *> _m) : id(_id), particles(_m){
//    twin = NULL;
}

Face::~Face(){
}

int Face::getID() const{
    return id;
}

Vector3D Face::getNormal() const{
    Vector3D v1, v2, v3;
    v1 = particles.at(0)->getPosition();
    v2 = particles.at(1)->getPosition();
    v3 = particles.at(2)->getPosition();
    return ((Vector((v3 - v2).crossProduct(v1 - v2))).normalize()).toVector3D();
}

Particle *Face::getParticleI(unsigned int _i){
    return particles.at(_i);
}

void Face::setParticleI(unsigned int _i, Particle *_m){
    particles.at(_i) = _m;
}

void Face::addParticle(Particle *_m){
    particles.push_back(_m);
}

unsigned int Face::getTotalVertices() const{
    return particles.size();
}

